<?php
$arrComment		= null;
$intTotalCmt	= 0;	
$intCmtType		= isset($intCmtType) ? $intCmtType : 0;
$intCategoryEdu	= isset($intCategoryEdu) ? $intCategoryEdu : 0;
$strKey			= 'ecmt' . $intEducateId . $intCmtType;
if(!isset($isEnableCookie)) {
	$intPageCmt	= isset($_COOKIE[$strKey]) ? $_COOKIE[$strKey] : $objRequest->getParam('page',1);
} else {
	$intPageCmt	= $objRequest->getParam('page',1);
}
$intLimitCmt	= CLIENT_LIMIT;
$intOffsetCmt	= (($intPageCmt-1) * $intLimitCmt);
$intTotalCmt	= $objEducation->getTotalForCmt($intCmtType, $intEducateId);
if($intTotalCmt > $intLimitCmt && !isset($_COOKIE[$strKey])) {
	$intPageCmt 	= ceil($intTotalCmt/$intLimitCmt);
	$intOffsetCmt 	= ($intPageCmt - 1) * $intLimitCmt;	
}
$arrComment	= $objEducation->getAllForCmt($intCmtType, $intEducateId, $intOffsetCmt, $intLimitCmt, $intTotalCmt);	
if(isset($isEnableCookie) && $isEnableCookie) {
	if($intPageCmt > 0) {
		PhungTK_Function::setCookie($strKey, $intPageCmt);
	} else {
		PhungTK_Function::deleteCookie($strKey);
	}
}

$this->view->intCmtType		= $intCmtType;
$this->view->intTotalCmt	= $intTotalCmt;
$this->view->intOffsetCmt	= $intOffsetCmt;
$this->view->intLimitCmt	= $intLimitCmt;
$this->view->intPageCmt		= $intPageCmt;
$this->view->strUrlCmt		= HOST_FRONTEND . 'comment/education?educateid=' . $intEducateId . '&type='. $intCmtType . '&';
$this->view->arrComment		= $arrComment;
$arrEducateR				= $objEducation->getEducationR($AppUI->id, $intEducateId);	
$this->view->arrErate		= $arrEducateR;
$this->view->intEducateId	= $intEducateId;
$this->view->intCategoryEdu	= $intCategoryEdu;
$this->view->noRate			= PhungTK_Function::arrayNumber(1,10);
?>